from django import forms
from rbac import models
from django.utils.safestring import mark_safe

ICON_LIST = [
    ['fa-graduation-cap', '<i class="fa fa-graduation-cap" aria-hidden="true"></i>'],
    ['fa-paper-plane', '<i class="fa fa-paper-plane" aria-hidden="true"></i>'],
    ['fa-phone-square', '<i class="fa fa-phone-square" aria-hidden="true"></i>'],
]
for item in ICON_LIST:
    item[1] = mark_safe(item[1])


class MenuForm(forms.ModelForm):
    class Meta:
        model = models.Menu
        fields = ['title', 'icon']

        widgets = {
            'icon': forms.RadioSelect(
                choices=ICON_LIST
            ),
            'title': forms.TextInput(attrs={'class': 'form-control'})
        }


class tmenu_func_form(forms.ModelForm):
    class Meta:
        model = models.Permission
        fields = '__all__'
